<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "/admin/include/head.htm">
<script type="text/javascript">
	var grid;
	$(function(){
		 grid = $("#maingrid").ligerGrid({
            columns: [
			{name: 'id', hide: true, width:0, isAllowHide: false},
			{display: '模板名称', name: 'name', align: 'left', width: 200 },
			{display: '描述', name: 'description', align: 'left', minWidth: 200 },
			{display: '模板文件路径', name: 'path', align: 'left', minWidth: 500 },
			{display: '操作', isAllowHide: false, 
				render: function (row){
					if (row["id"]) {
						var html = '<a href="#" onclick="editTemplateFile(\'' + row.id + '\',\'' + row.description + '\'); return false;">[编辑]</a>';
						return html;
					}
                }
			}],  pageSize:20, url: 'queryData.jhtml',checkbox:false,
			toolbar: null, width: '100%', height:'100%', enabledSort: true
        });
        //双击事件(id:为点击操作的id)
      	LG.setGridDoubleClick(grid, 445);
        $("#pageloading").hide();
		LG.loadToolbar(grid);
		
		//绑定搜索按钮
		LG.search(grid);
	});
	function editTemplateFile(id,name){
		if (top.f_isTabItemExist("template" + id)) {
			top.f_switchTab("template" + id);
		}else {
			var tname;
			switch("${type}"){
				case "email":tname="邮件模板";break;
				case "article":tname="文章模板";break;
				case "sms":tname="短信模板";break;
				default:tname="其他模板";
			}
			top.f_addTab("template" + id, tname+'[' + name + ']', base + '/admin/system/template/${type}/edit/' + id + '.jhtml');
		}
	}
</script>
</head>
<body style="padding:10px; overflow:hidden;">
	<div id="maingrid" style="margin:0; padding:0"></div>
</body>
</html>